package cn.tedu.demo.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Worker {
    private String name="光头强";
    //@Autowired//自动注入
    private Axe axe;//默认值 null
    @Autowired
    private Saw saw;

    public Worker(){
        System.out.println("创建了工人");
    }
    public void work(){
        System.out.println(name+"使用"+saw+"砍树!");
    }
}
